home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
lines
< prev
next >
Wrap
Text File
|
1995-03-31
|
3KB
|
152 lines
Article 5340 of comp.sys.handhelds:
Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!ahernsd
From: ahernsd@mentor.cc.purdue.edu (Dynastar)
Newsgroups: comp.sys.handhelds
Subject: HP48sx program: lineart (very simple)
Message-ID: <8741@mentor.cc.purdue.edu>
Date: 26 Mar 91 06:54:00 GMT
Organization: Purdue University
Lines: 139
Ok, here is my first posting of an HP program.
It is a program that I have vowed to write on every computer I
touch. (although going graphics routines on a dumb terminal in
UNIX would be interesting...)
This a program that I'm sure you all have seen somewhere.
It bounces a line around the screen, mirroring it as it goes.
Various versions of the program have the line erasing itself
after a while, but I'm working on that version. The program
also does a little beep thing when a line hits a wall if you
have your beeps on.
Just download the whole thing to the 48 using ASCII transfer
and press LINES to begin the thing. It is a nice little demo
of the 48's graphics. It also makes neat images to DISS into
one another!
The whole program takes up 1667.5 bytes. Does anyone know of
a way to reduce this size? I should be able to have this program
in less than 1K, but I don't know of anyway to reduce my code.
(Yes I know there are a lot of stupid things in this program, but
go ahead and yell at me, I'm willing to learn.)
Happy programming!
-----------------hmmmm, I wonder what this line means?---------
%%HP: T(3)A(R)F(.);
DIR
LINES
\<< { # 0d # 0d }
PVIEW
DO INIT ERASE
DO 1
'COUNT' STO+ FIXP
R1 R2 C1 C2 MLINE
CR1 'R1' STO+ CR2
'R2' STO+ CC1 'C1'
STO+ CC2 'C2' STO+
CASE 'R1<
1' 'R1>63' OR
THEN
UR1
END 'R2
<1' 'R2>63' OR
THEN
UR2
END 'C1
<1' 'C1>130' OR
THEN
UC1
END 'C2
<1' 'C2>130' OR
THEN
UC2
END
END
UNTIL COUNT
20 ==
END
UNTIL 0
END
\>>
INIT
\<< RAND 130 *
'C1' STO RAND 130 *
'C2' STO RAND 64 *
'R1' STO RAND 64 *
'R2' STO RAND 10 *
5 - 'CR1' STO RAND
10 * 5 - 'CR2' STO
RAND 10 * 5 - 'CC1'
STO RAND 10 * 5 -
'CC2' STO 0 'COUNT'
STO FIXP
\>>
MLINE
\<< \-> R1 R2 C1 C2
\<< C1 R1 DCONV
C2 R2 DCONV TLINE
130 C1 - R1 DCONV
130 C2 - R2 DCONV
TLINE C1 64 R1 -
DCONV C2 64 R2 -
DCONV TLINE 130 C1
- 64 R1 - DCONV 130
C2 - 64 R2 - DCONV
TLINE
\>>
\>>
DCONV
\<< R\->B SWAP R\->B
SWAP 2 \->LIST
\>>
FIXP
\<< R1 0 RND 'R1'
STO R2 0 RND 'R2'
STO C1 0 RND 'C1'
STO C2 0 RND 'C2'
STO
\>>
BOING
\<< 2000 10000
FOR I I .01
BEEP 2000
STEP
\>>
GR
\<< 1.5 RAND -
NEG
\>>
UR1
\<< GR CR1 * 0
RND 'CR1' STO CR1
'R1' STO+ BOING
\>>
UR2
\<< GR CR2 * 0
RND 'CR2' STO CR2
'R2' STO+ BOING
\>>
UC1
\<< GR CC1 * 0
RND 'CC1' STO CC1
'C1' STO+ BOING
\>>
UC2
\<< GR CC2 * 0
RND 'CC2' STO CC2
'C2' STO+ BOING
\>>
END
---------------------finally!---------------
--
Sean Ahern ----------- Purdue University --------- ahernsd@mentor.cc.purdue.edu
Dan Quayle: "Japan is an important ally of ours. Japan and the United States
of the Western industrialized capacity, 60 percent of the GNP,
:-) two countries. That's a statement in and of itself."